<div class="register-main">
  <div class="loading" *ngIf="registering"></div>
  <div class="register-block">
    <form id="enterpriseRigterForm" [formGroup]="registerForm" (ngSubmit)="onSubmit()" class="form-horizontal">
      <div class="form-group row">
        <label for="userSub_username" class="col-sm-2 control-label">用户名</label>

        <div class="col-sm-10">
          <input type="text" class="form-control" id="userSub_username" formControlName="userSub_username">
          <span class="error-info" style="color: red">{{formErrors.userSub_username}}</span>
        </div>
      </div>

      <div class="form-group row">
        <label for="password" class="col-sm-2 control-label">密码</label>

        <div class="col-sm-10">
          <input type="password" class="form-control" id="password" formControlName="password">
          <span class="error-info" style="color: red">{{formErrors.password}}</span>
        </div>
      </div>

      <div class="form-group row">
        <label for="passwordRepeat" class="col-sm-2 control-label">确认密码</label>

        <div class="col-sm-10">
          <input type="password" class="form-control" id="passwordRepeat" formControlName="passwordRepeat">
          <span class="error-info" *ngIf="registerForm.hasError('mismatchedPasswords')"  style="color: red">确认密码和密码不匹配.</span>

        </div>
      </div>

      <div class="form-group row">
        <label for="enterpriseSub_name" class="col-sm-2 control-label">企业名称</label>

        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_name" formControlName="enterpriseSub_name">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_name}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_entertype" class="col-sm-2 control-label">企业类型</label>

        <div class="col-sm-10">
          <select class="form-control" id="enterpriseSub_entertype" formControlName="enterpriseSub_entertype">
            <option [value]="entertype" *ngFor="let entertype of entertypes">{{entertype}}</option>
          </select>
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_entertype}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_license" class="col-sm-2 control-label">营业执照</label>

        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_license" formControlName="enterpriseSub_license">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_license}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_registerarea" class="col-sm-2 control-label">企业注册地</label>

        <div class="col-sm-10">
          <select class="form-control" id="enterpriseSub_registerarea" formControlName="enterpriseSub_registerarea">
            <option [value]="province" *ngFor="let province of provinces">{{province}}</option>
          </select>
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_registerarea}}</span>
        </div>
      </div>

      <!--<div class="form-group row">
        <label for="enterpriseSub_industry" class="col-sm-2 control-label">行业</label>
        <div class="col-md-2">
          <label class="radio-inline custom-radio nowrap">
            <input type="radio" name="enterpriseSub_industry" id="industry-roadway" value="公路" (click)="getValue('公路')">
            <span>公路</span>
          </label>
        </div>
        <div class="col-md-2">
          <label class="radio-inline custom-radio nowrap">
            <input type="radio" name="enterpriseSub_industry" id="industry-water" value="水运" (click)="getValue('水运')">
            <span>水运</span>
          </label>
        </div>
        <div class="col-md-2">
          <label class="radio-inline custom-radio nowrap">
            <input type="radio" name="enterpriseSub_industry" id="industry-roadway-water" value="公路水运" (click)="getValue('公路水运')">
            <span>公路水运</span>
          </label>
        </div>
      </div>-->

      <div class="form-group row">
        <label for="enterpriseSub_registeredcapital" class="col-sm-2 control-label">注册资金(万元)</label>
        <div class="col-sm-10">
          <input type="number" class="form-control" id="enterpriseSub_registeredcapital" formControlName="enterpriseSub_registeredcapital" min="1">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_registeredcapital}}</span>

        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_establishtime" class="col-sm-2 control-label">建立时间</label>
        <div class="col-sm-10">
          <input datePicker id="enterpriseSub_establishtime" type="text" class="form-control" readonly>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_website" class="col-sm-2 control-label">企业网址</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_website" formControlName="enterpriseSub_website">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_website}}</span>
        </div>
      </div>


      <div class="form-group row">
        <label class="col-sm-2 control-label">申请函</label>
        <div class="col-sm-10">
          <file-upload [url]="fileUploadUrl" [name]="appLetter" [fileSizeLimit]="sizeLimit" [disable]="disableUpload"
                       (onFinishUploading)="onFinishUploading($event)"
                       (onUploading)="onFileUploading($event)"></file-upload>
        </div>
      </div>

      <div class="form-group row">
        <label class="col-sm-2 control-label">施工资质证书</label>
        <div class="col-sm-10">
          <file-upload [url]="fileUploadUrl" [name]="constructionCert" [fileSizeLimit]="sizeLimit" [disable]="disableUpload"
                       (onFinishUploading)="onFinishUploading($event)"
                       (onUploading)="onFileUploading($event)"></file-upload>
        </div>
      </div>

      <div class="form-group row">
        <label class="col-sm-2 control-label">安全许可证</label>
        <div class="col-sm-10">
          <file-upload [url]="fileUploadUrl" [name]="securityCert" [fileSizeLimit]="sizeLimit" [disable]="disableUpload"
                       (onFinishUploading)="onFinishUploading($event)"
                       (onUploading)="onFileUploading($event)"></file-upload>
        </div>
      </div>

      <div class="form-group row">
        <label class="col-sm-2 control-label">企业营业执照</label>
        <div class="col-sm-10">
          <file-upload [url]="fileUploadUrl" [name]="businessLicense" [fileSizeLimit]="sizeLimit" [disable]="disableUpload"
                       (onFinishUploading)="onFinishUploading($event)"
                       (onUploading)="onFileUploading($event)"></file-upload>
        </div>
      </div>

      <div class="form-group row">
        <label for="enterpriseSub_permitid" class="col-sm-2 control-label">安全生产许可证书编号</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_permitid" formControlName="enterpriseSub_permitid">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_permitid}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_certificateid" class="col-sm-2 control-label">企业资质证书编号</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" formControlName="enterpriseSub_certificateid" id="enterpriseSub_certificateid">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_certificateid}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_postcode" class="col-sm-2 control-label">邮政编码</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_postcode" formControlName="enterpriseSub_postcode">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_postcode}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_address" class="col-sm-2 control-label">联系地址</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_address" formControlName="enterpriseSub_address">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_address}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_contact" class="col-sm-2 control-label">联系人</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_contact" formControlName="enterpriseSub_contact">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_contact}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_contacttel" class="col-sm-2 control-label">联系人电话</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_contacttel" formControlName="enterpriseSub_contacttel">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_contacttel}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_email" class="col-sm-2 control-label">联系人邮箱</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_email" formControlName="enterpriseSub_email">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_email}}</span>
        </div>
      </div>
      <div class="form-group row">
        <label for="enterpriseSub_legalperson" class="col-sm-2 control-label">法人代表</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="enterpriseSub_legalperson" formControlName="enterpriseSub_legalperson">
          <span class="error-info" style="color: red">{{formErrors.enterpriseSub_legalperson}}</span>
        </div>
      </div>

      <div class="row" *ngIf="registerError" style="text-align: center;">
        <span class="error-info" style="color: #d9534f;">{{errorMsg}}</span>
      </div>

      <div class="form-group row">
        <div class="col-sm-10">
          <button type="submit" class="btn btn-primary btn-auth" [disabled]="!registerForm.valid">注册</button>
        </div>
        <div class="col-sm-2 to-login">
          <a routerLink="/login/company">已有账号？</a>
        </div>
      </div>
    </form>
  </div>
</div>

<div bsModal #smModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"
     aria-hidden="true"
     (onHide)="onHideModal()">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button class="close" aria-label="Close" (click)="hideSuccessModal()">
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title">注册提交成功</h4>
      </div>
      <div class="modal-body">
        注册提交成功，点击确定跳转到主页。
      </div>
      <div class="modal-footer">
        <button class="btn btn-primary confirm-btn" (click)="redirect()">确定</button>
      </div>
    </div>
  </div>
</div>
